#include<stdio.h>
#define size 10

int judge(char ch[size])
{
	int i = 0, num = 1;
	for (i; i < size; i++)
	{
		if (ch[i] == ch[i + 1])
		{
			num++;
		}
		if (num >= 3) return 1;
	}
	if (num <= 2) return 0;
}
int main()
{
	int judge(char ch[size]);
	int i = 0, num = 1, j = 0, k = 0;
	char arr[size] = { '0' }, a[size] = { '0' };
	for (i; i < size; i++)
	{
		scanf("%c", &arr[i]);
	}
	int judg = judge(&arr[size]);
	if (judg != 0)
	{
		for (i; i < size; i++)
		{
			if (arr[i] == arr[i + 1])
			{
				num++;
				k = i;
			}
			if (arr[i] != arr[i + 1] && num <= 1)
			{
				a[j] = arr[i];
				j++;
			}
			if (arr[i] != arr[i + 1] && num >= 2)
			{
				a[j] = arr[i];
				a[j + 1] = 'k';
				j++;
			}
		}
	}
	else printf("NO");
	return 0;
}

